<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="Clases.*" %>

<%if (session.getAttribute("UsuarioActual")!=null) {%> 
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<head><title>Inicio</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="dist/css/bootstrap.min.css" rel="stylesheet" />
<script>
function error()
			{
				var QueryString = function () {
					  // This function is anonymous, is executed immediately and 
					  // the return value is assigned to QueryString!
					  var query_string = {};
					  var query = window.location.search.substring(1);
					  var vars = query.split("&");
					  for (var i=0;i<vars.length;i++) {
					    var pair = vars[i].split("=");
					    	// If first entry with this name
					    if (typeof query_string[pair[0]] === "undefined") {
					      query_string[pair[0]] = pair[1];
					    	// If second entry with this name
					    } else if (typeof query_string[pair[0]] === "string") {
					      var arr = [ query_string[pair[0]], pair[1] ];
					      query_string[pair[0]] = arr;
					    	// If third or later entry with this name
					    } else {
					      query_string[pair[0]].push(pair[1]);
					    }
					  } 
					    return query_string;
					} ();
					if(QueryString.error==1)
						{	window.alert("El profesional ya existe");
							window.location.href="profesionales.jsp";}
					if(QueryString.error==2)
						{	alert("Existe un turno para ese horario con ese profesional");
							window.location.href="turnos.jsp";}
			}
</script>

</head>

<body>

<%if(Integer.parseInt(session.getAttribute("Tipo").toString())==1){ %>
<%@include file="menusecretarias.jsp" %>
<%}else{%>
<%@include file="menuprofesionales.jsp" %>
<%} %>

<div class="container">

</div>

<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="dist/js/bootstrap.min.js"></script>

</body>
</html>
<%} else response.sendRedirect("LoginProfesional.jsp"); %>
